﻿/**
 * [1 Timothy 3:16-17 ESV]
 * All Scripture is breathed out by God and profitable
 * for teaching, for reproof, for correction, and for training in righteousness,
 * that the man of God may be complete, equipped for every good work.
 *
 * 本工具可用于圣经研究、日常查经、深入原文学习等用途，目标受众是中文为母语的基督徒
 *
 * 本文件信息
 * @version 0.1.14
 * @author timothy
 *
 * @copyright GPL
 */
#ifndef BIBLECOMMENTARYBROWSER_H
#define BIBLECOMMENTARYBROWSER_H

#include <QTextBrowser>
#include <QPoint>
#include "biblereadercore.h"
#include "biblereadertooltip.h"

/**
 * @brief The BibleCommentaryBrowser class
 * Commentary Browser
 */
class BibleCommentaryBrowser : public QTextBrowser
{
    Q_OBJECT
public:
    BibleCommentaryBrowser(BibleReaderCore *brc, QWidget *parent = nullptr);
    virtual ~BibleCommentaryBrowser();

protected:
    void mouseMoveEvent(QMouseEvent *e);
    void keyPressEvent(QKeyEvent *e);
    void keyReleaseEvent(QKeyEvent *e);
    void enterEvent(QEvent *e);
    void leaveEvent(QEvent *e);
    void contextMenuEvent(QContextMenuEvent *e);

private:
    BibleReaderCore *brCore;
    BibleReaderToolTip *tooltip;
    int screenWidth;
    int screenHeight;
    bool shiftPressed;
    bool ctrlPressed;

private slots:
    void setCurrentBCV(QUrl url);
    void printCmt();
    void saveCmt();

private:
    void showToolTip(QString text, QPoint pos);
    QString getXrefStrBySelection(QString selection);
};


#endif // BIBLECOMMENTARYBROWSER_H
